import java.util.Arrays;

public class IsAnagram {
    public static boolean isAnagram(String s, String t) {
        int n=s.length();
        int m=t.length();
        if(n!=m){
            return false;
        }
        int []x=new int [26];
        int []y=new int [26];
        for(int i=0;i<n;i++){
            x[s.charAt(i)-'a']++;
        }
        for(int i=-0;i<m;i++){
            y[t.charAt(i)-'a']++;
        }
        System.out.println(Arrays.toString(x));
        System.out.println(Arrays.toString(y));
        if(Arrays.equals(x,y)){
            return true;
        }else{
            return false;
        }
    }
    public static void main(String[] args) {
        System.out.println(isAnagram("rat", "cat"));

    }
}
